package cn.tedu.blog.server.mapper;

import cn.tedu.blog.server.pojo.dto.CategoryAddDTO;
import cn.tedu.blog.server.pojo.entity.Category;
import cn.tedu.blog.server.pojo.vo.ArticleDetailVO;
import cn.tedu.blog.server.pojo.vo.CategoryDetailVO;
import cn.tedu.blog.server.pojo.vo.CategoryListVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: 雷茂林
 * @Date:2022/7/25 21:50
 * @Description:
 */
@Repository
public interface CategoryMapper {

    int insert(Category category);

    int countByName(String name);

    int deleteById(Long id);

    int deleteByIds(Long[] ids);

    CategoryDetailVO getById(Long id);

    int articleCountById(Long id);

    int updateById(CategoryAddDTO categoryAddDTO);

    /**
     * 修改类别对应文章的数量
     */
    int updateArticleCountById(@Param("id")Long id,@Param("categoryId")Long categoryId);

    List<CategoryListVO> list();

    CategoryDetailVO selectById(Long id);

    Long selectIdByName(String category);

    List<CategoryDetailVO> selectByids(Long[] ids);

    int ArticleCount(Long id);

    int getCountAll(CategoryListVO categoryListVO);

    List<CategoryListVO> listByCategory(CategoryListVO categoryListVO);

    /*前台查询分类文章*/
    List<CategoryListVO> listAll();
}
